package com.devplatform.service.impl.article;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.devplatform.mapper.article.ArticleReviewMapper;
import com.devplatform.pojo.article.Article;
import com.devplatform.pojo.article.ArticleReview;
import com.devplatform.pojo.dto.ReviewOperateDto;
import com.devplatform.pojo.user.User;
import com.devplatform.pojo.vo.DataVo;
import com.devplatform.service.article.ArticleReviewService;
import com.devplatform.service.article.ArticleService;
import com.devplatform.service.impl.UserService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author Jnks03
 * @description 针对表【article_review】的数据库操作Service实现
 * @createDate 2025-10-04 22:35:38
 */
@Service
@RequiredArgsConstructor
public class ArticleReviewServiceImpl extends ServiceImpl<ArticleReviewMapper, ArticleReview>
        implements ArticleReviewService {
    private final ArticleService articleService;
    private final UserService userService;

    @Override
    @Transactional(rollbackFor = Exception.class)
    public DataVo autoReviewArticle(Long articleId) {
        Article article = articleService.getById(articleId);
        if (article == null) {
            return DataVo.error("文章不存在");
        }

        // 获取作者信誉度
        User user = userService.getById(article.getAuthorId());
        if (user == null) {
            return DataVo.error("用户不存在");
        }
        return null;
    }

    @Override
    public DataVo getPendingReviewArticles(Integer pageNum, Integer pageSize) {
        return null;
    }

    @Override
    public DataVo manualReviewArticle(ReviewOperateDto dto) {
        return null;
    }
}




